program Summators;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  StupidSummator=class
    N:integer;
    Procedure Sum;
  end;
  SmartSummator=class(StupidSummator)
    Procedure Sum(override);
  end;
{ StupidSummator }

procedure StupidSummator.Sum(N:integer);

var
  sum:integer;

begin
  sum:=0
  for i:=1 to N do
    sum:=sum+i;
  writeln(sum)
end;

{ SmartSummator }

procedure SmartSummator.Sum(override, N: integer);

var
  sum:integer;

begin
  sum:=N*(N-1)/2
  writeln(sum)
end;

var
  N:integer;
  SuS:StupidSummmator;
  SaS:SmartSummator;

begin
  read(N);
  SuS.Sum(N);
  SaS.Sum(N);
  readln;
end.
